package com.ruixun.shopmanagement.controller;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruixun.shopmanagement.entity.Category;
import com.ruixun.shopmanagement.service.inter.CategoryService;

@Controller
@RequestMapping("/category")
@ResponseBody
public class CategoryController {
	
	@Autowired
	CategoryService categoryService;
	/**
	 * 
	* @Title: findall 查询所有得种类,使用mybatis+第三方缓存ehcache,
	* @Description:
	* @author: 1246263205@qq.com
	* @date 2019年12月19日 下午2:37:52
	* @param request
	* @param response
	* @return List<Category>
	* @version
	 */
	@RequestMapping(value = "/findall", method = RequestMethod.GET)
	public List<Category> findall(HttpServletRequest request, HttpServletResponse response) {
		List<Category> list=categoryService.findAllCategory();
		return list;
	}
	@RequestMapping(value = "/findOne", method = RequestMethod.GET)
	public Category findall(int cid) {
		Category category=categoryService.findOneByCid(cid);
		return category;
	}
	
	
}
